<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('月度评价任务台账列表')"/>
</head>
<body class="pear-container">
<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">分公司名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="subcompanyName" placeholder="" class="layui-input">
                </div>
                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                        lay-filter="subcommitplan-query">
                    <i class="layui-icon layui-icon-search"></i>
                    查询
                </button>
                <button type="reset" class="pear-btn pear-btn-md">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
        </form>
    </div>
</div>
<div class="layui-card">
    <div class="layui-card-body">
        <table id="subcommitplan-table" lay-filter="subcommitplan-table"></table>
    </div>
</div>
</body>

<script id="taskFillingScore-bar3" type="text/html">
    {{#if(d.taskState != 0 ){ }}
    <img th:src="@{/static/admin/images/img/carryOut.png}" class="layui-nav-img">
    {{# }else{ }}
    <img th:src="@{/static/admin/images/img/notCarryOut.png}" class="layui-nav-img">
    {{# } }}
</script>


<th:block th:include="include :: footer"/>
<script th:inline="javascript" type="text/javascript">
    /*<![CDATA[*/
    var evaluationId = /*[[${evaluationId}]]*/ 20;
    /*]]>*/

    layui.use(['table', 'form', 'jquery'], function () {
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery;
        var MODULE_PATH = rootPath + "/MonthAuditSubController/";
        var cols = [
            [

                {title: '任务年月', field: 'taskMonth', align: 'center'},

                {title: '分公司名称', field: 'subcompanyName', align: 'center'},

                {title: '分公司是否提报', toolbar: '#taskFillingScore-bar3', align: 'center', width: 200},

                {title: '下属供电所总数量', field: 'subTotal', align: 'center'},

                {
                    title: '完成填报数', field: 'subFinishTotal', align: 'center', templet: function (d) {
                        return '<div><a class="layui-table-link" target="_blank" onclick="supplylistFinish(\'' + d.fkSubcompanyId + '\')">'+d.subFinishTotal+'</a></div>';
                    }
                },

                {title: '未完成填报数', field: 'subNotFinishTotal', align: 'center', templet: function (d) {
                        return '<div><a class="layui-table-link" target="_blank" onclick="supplylistnotFinish(\'' + d.fkSubcompanyId + '\')">'+d.subNotFinishTotal+'</a></div>';
                    }
                },

            ]
        ]

        //table表单列表
        table.render({
            elem: '#subcommitplan-table',
            url: MODULE_PATH + 'list4subcommitplan/' + evaluationId,
            page: true,
            method: 'get',
            cols: cols,
            skin: 'line',
            toolbar: '#subcommitplan-toolbar',
            defaultToolbar: [{
                layEvent: 'refresh',
                icon: 'layui-icon-refresh',
            }]
        });


        //查询按钮绑定
        form.on('submit(subcommitplan-query)', function (data) {
            table.reload('subcommitplan-table', {where: data.field})
            return false;
        });

        //table工具栏绑定
        table.on('toolbar(subcommitplan-table)', function (obj) {
            if (obj.event === 'add') {
                window.add();
            } else if (obj.event === 'refresh') {
                window.refresh();
            } else if (obj.event === 'batchRemove') {
                window.batchRemove(obj);
            }
        });


        //刷新按钮
        window.refresh = function () {
            table.reload('subcommitplan-table');
        }

        //完成点击穿透
        window.supplylistFinish = function (d) {
            //新输入的内容
            var index = layer.open({
                type: 2,
                title: '已完成填报供电所清单',
                shade: 0.1,
                area: ['650px', '650px'],
                content: MODULE_PATH + 'supplyList/'+evaluationId+'/'+d+'/'+1
            });
        }
        //未完成列表点击穿透
        window.supplylistnotFinish = function (d) {
            console.log(d)
            //新输入的内容
            var index = layer.open({
                type: 2,
                title: '未完成填报供电所清单',
                shade: 0.1,
                area: ['650px', '650px'],
                content: MODULE_PATH + 'supplyList/'+evaluationId+'/'+d+'/'+0
            });
        }
    })
</script>
</html>